home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Freeware / Programare / bluej / bluejsetup-200.exe / {app} / examples / people / Student.java < prev   
Encoding:
Text File  |  2004-09-15  |  981 b   |  53 lines

  1. /**
  2.  * A class representing students for a simple BlueJ demo program.
  3.  *
  4.  * @author  Michael Kolling
  5.  * @version 1.0, January 1999
  6.  */
  7.  
  8. class Student extends Person
  9. {
  10.     private String SID;    // student ID number
  11.  
  12.     /**
  13.      * Create a student with default settings for detail information.
  14.      */
  15.  
  16.     Student()
  17.     {
  18.         super("(unknown name)", 0000);
  19.         SID = "(unknown ID)";
  20.     }
  21.  
  22.  
  23.     /**
  24.      * Create a student with given name, year of birth and student ID
  25.      */
  26.     Student(String name, int yearOfBirth, String studentID)
  27.     {
  28.         super(name, yearOfBirth);
  29.         SID = studentID;
  30.     }
  31.  
  32.     /**
  33.      * Return the student ID of this student.
  34.      */
  35.     public String getStudentID()
  36.     {
  37.        return SID;
  38.     }
  39.  
  40.     /**
  41.      * Return a string representation of this object.
  42.      */
  43.     public String toString()    // redefined from "Person"
  44.     {
  45.         return super.toString() +
  46.                "Student\n" +
  47.                "Student ID: " + SID + "\n";
  48.     }
  49.  
  50. }
  51.  
  52.  
  53.